#ifndef _EEPROM_H_
#define _EEPROM_H_

#include "Global.h"


#define C_EEP_DATA_SIZE     4
#define C_EEP_BASE_ADDR     0x01


typedef struct
{
    uint8 Head;
    uint8 Data[C_EEP_DATA_SIZE];
    uint8 CheckSum;
}Typedef_EEPROM;

typedef union 
{
    Typedef_EEPROM  Detail;
    uint8   Buf[sizeof(Typedef_EEPROM)];
}U_EEPROM;


#define EEP_OFFSET_ROLLINGCODE      0       // 滚动码偏移地址
#define EEP_SIZE_ROLLINGCODE        3       // 滚动码3个字节
#define EEP_OFFSET_ZUOWEN           (EEP_OFFSET_ROLLINGCODE+EEP_SIZE_ROLLINGCODE)       // 座温档位偏移地址
#define EEP_SIZE_ZUOWEN             1       // 座温档位长度

// #define EEP_ADDR_TYPE   0x01
// #define EEP_ADDR_TEST   0x11

// void Memory_Write(unsigned char Addr,unsigned char Value);
// uint8  Memory_Read(unsigned char Addr);

void Memory_Read(unsigned char Addr, uint8* buf, uint8 len);
void Memory_Write(unsigned char Addr,unsigned char* buf, unsigned char len);

// void EEP_Load(uint8* addr, uint8 offset, uint8 len);
// void EEP_Save(uint8 addr, uint8* pData, uint8 len);
void EEP_Save(void);
uint8 EEP_Load(void);

#endif

